package begin;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import tools.UtilJDBC;
import view.LoginView;
import view.RegisterView;

import java.io.IOException;
import java.util.Scanner;
import java.util.Stack;

/**
 * @Author 王志康
 * @Date 2021/9/5 14:09
 * @Version 1.0.0
 */
public class MainView extends Application {
    private static Stage stage=new Stage();

    public static void main(String[] args) {
        UtilJDBC.basic();
        launch(args);
        UtilJDBC.close();
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("丰翼超市购物管理系统");
        stage = primaryStage;
        gotoLoginView();
        primaryStage.show();
    }

    public void gotoMainView() {
        start(stage);
    }

    /**
     * 窗口内跳转至登录页面
     */
    public static void gotoLoginView() {
        try {
            stage.setScene(LoginView.show());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 窗口内跳转至注册页面
     */
    public static void gotoRegisterView() {
        try {
            stage.setScene(RegisterView.show());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
